"""
    Service payment record controller.
"""

from mnemoply import model
from mnemoply.controllers.lookup import LookupController, TableCol, TableLookupDataSource
from mnemoply.controllers.crud import CRUDController

class ServicePaymentRecordController(LookupController, CRUDController):
    model_object = model.ServicePaymentRecord
    lookup_columns = [
        TableCol(name='payment_date', caption=_('Payment date')),
        TableCol(name='organization', caption=_('Organization')),
        TableCol(name='customer', caption=_('Customer')),
        TableCol(name='service', caption=_('Service')),
        TableCol(name='department', caption=_('Department')),
        TableCol(name='cash_register', caption=_('Cash register')),
        TableCol(name='cost', caption=_('Cost')),
    ]
    view_fields = ['agreementID', 'paymentDate', 'cost', 'cashRegisterID']

    def __init__(self):
        LookupController.__init__(self,
            data_source=TableLookupDataSource('service_payment_record_lookup'),
            columns=self.lookup_columns,
            title=self.model_object.model_title,
        )
        CRUDController.__init__(self, model_object=self.model_object)

exposed = ServicePaymentRecordController()
